<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>Document</title>
		<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
	</head>
	<body>
		<button id="btnGET">GET</button>
		<button id="btnPOST">POST</button>
		<button id="btnDelete">BELETE</button>
		<button id="btnJsonp">JSONP</button>
		<script>
			$(function() {
				$('#btnGET').on('click', () => {
					$.ajax({
						type: 'GET',
						url: 'http://127.0.0.1:8080/api/get',
						data: {
							name: '55',
							age: 66
						},
						success: (res) => {
							console.log(res)
						}
					})
				})

				$('#btnPOST').on('click', () => {
					$.ajax({
						type: 'POST',
						url: 'http://127.0.0.1:8080/api/post',
						data: {
							name: '9999',
							age: 9999
						},
						success: (res) => {
							console.log(res)
						}
					})
				})


				$('#btnDelete').on('click', () => {
					$.ajax({
						type: 'DELETE',
						url: 'http://127.0.0.1:8080/api/delete',
						data: {
							name: 'btnDelete',
							age: 123
						},
						success: (res) => {
							console.log(res)
						}
					})
				})
				
				$('#btnJsonp').on('click', () => {
					$.ajax({
						type: 'GET',
						url: 'http://127.0.0.1:8080/api/jsonp',
						dataType:'jsonp',
						success:(res)=>{console.log(res)}
						
						
					})
				})

			})
		</script>
	</body>
</html>
